<!DOCTYPE html>
<html>
<head>
	<title></title>
	<meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	<link rel="stylesheet" type="text/css" href="/static/css/hw-admin.css">

	<link rel="stylesheet" href="/static/css/lb.css"> 
	<style>
	.main-table-wrap{
		padding: 0 20px;
	}
	.opt span {
		cursor: pointer;
	}
	</style>
   	<!--[if lt IE 9]>
    　 <script src="https://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
       <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.js"></script>
    <![endif]-->
</head>
<body>

	<div class="hw-iframe">
		<!-- 顶部标题 -->
        <div class="hw-header-wrapper">
            <div class="hw-header">
                <div class="hw-header__item--left">
                    酒店列表
                </div>
            </div>
        </div>

        <!-- 顶部筛选 -->
        <div class="hw-filter-wrapper">
			<div class="hw-filter">
				<form method="GET" action="<?=$url ?>">
					<div class="default-filter"> 
						<div class="hw-input-label"> 
							<div class="form-control">
								<div class="hw-search-prevent">
									<input type="text" id="company-name" class="hw-input" placeholder="请输入酒店名称" name="screen" value="<?=isset($_GET['screen']) ? $_GET['screen'] : '' ?>">
									<button class="search-btn" type="submit"><i class="iconfont"></i></button>
								</div>
							</div>
						</div>
						<input type="hidden" id="state" name="state" value="">
						<div class="filter-switch" data-status="">更多筛选条件<i style="transform: scale(0.56);" class="iconfont hw-down">&#xe87d;</i><i  style="transform: scale(0.56);" class="iconfont hw-up hide">&#xe87e;</i></div>
					</div>
					<div class="filter-detail" style="display: <?=isset($_GET['start_time']) ? 'block' : 'none' ?>">
						<div class="filter-item">
							<div class="hw-input-label">
								<label class="name" for="">合作时间</label>
								<div class="input-icon-group">
									<input type="text" id="startime" onclick="WdatePicker({maxDate:'#F{$dp.$D(\'endtime\',{d: -1})||\'%y-%M-{%d-1}\'}'})"  placeholder="选择日期" name="start_time" value="<?=isset($_GET['start_time']) ? $_GET['start_time'] : '' ?>"  autocomplete="off" disableautocomplete>
									<div class="icon-wrapper">
										<i class="iconfont">&#xe601;</i>
									</div>
								</div>
							</div>

							<div class="hw-input-label">
								<label class="name" for="" style="width: 34px;text-align: center;">——</label>
								<div class="input-icon-group">
									<input type="text" id="endtime" onclick="WdatePicker({minDate:'#F{$dp.$D(\'startime\',{d:1});}',maxDate: '%y-%M-%d'})"  placeholder="选择日期" name="end_time" value="<?=isset($_GET['end_time']) ? $_GET['end_time'] : '' ?>"  autocomplete="off" disableautocomplete>
									<div class="icon-wrapper">
										<i class="iconfont">&#xe601;</i>
									</div>
								</div>
							</div>
							<div class="operate-btns">
								<div style="float: left;" class="hw-btn hw-default-btn reset_form"><i style="font-size: 13px;position: relative;left: -2px;" class="iconfont">&#xe629;</i>重置</div>
								<button class="hw-btn"><i class="iconfont">&#xe9df;</i>查询</button>
							</div>
						</div>
					</div>
				</form>
			</div>
		</div>
		
		<!-- 表格 -->
		<div class="main-table-wrap">
            <form id="table-form" method="POST" action="">
				<table cellspacing="0" cellpadding="0" border="0">  
					<colgroup>
						<col class="col-3">
						<col class="col-6">
						<col class="col-10">
						<col class="col-6">
						<col class="col-5">
						<col class="col-8">
						<col class="col-8">
				
					</colgroup>

					<thead>
						<tr>
							<th>序号</th>
							<th>酒店名称</th>
							<th>酒店地址</th>
							<th>联系方式</th>
							<th class="hover-th">
								<span>
									<?php if (isset($_GET['state'])): ?>
	                                    <?php switch ($_GET['state']) {
	                                        case '0':
	                                            echo '正常';
	                                            break;

	                                        case '1':
	                                            echo '停用';
	                                            break;
	                                        
	                                        default:
	                                            echo '合作状态';
	                                            break;
	                                    } ?>
	                                <?php else: ?>
	                                    合作状态
	                                <?php endif ?>
									<i class="iconfont"></i>
								</span>
								<div class="hover-content"> 
									<ul class="info" data-target="#state"> 
										<li class="list <?=isset($_GET['state']) ? ($_GET['state'] == '' ? 'active' : '') : 'active' ?>" data-value="">全部</li>
										<li class="list <?=isset($_GET['state']) && $_GET['state'] === '0' ? 'active' : '' ?>" data-value="0">正常</li>
										<li class="list <?=isset($_GET['state']) && $_GET['state'] === '1' ? 'active' : '' ?>" data-value="1">停用</li>
									</ul>
								</div>
							</th>
							<th>合作开始时间</th>
							<th>操作</th>
						</tr>
					</thead>
					

					<tbody>
						<?php foreach ($list as $key => $value): ?>
							<tr>
								<td><?=$key+1 ?></td>
								<td><?=$value['name'] ?></td>
								<td><?=$value['province'].$value['city'].$value['area'].$value['address'] ?></td>
								<td><?=$value['phone'] ?></td>
								<?php if ($value['state'] == 0): ?>
									<td class="green-color">正常</td>
								<?php else: ?>
									<td class="red-color">停用</td>
								<?php endif ?>
								<td><?=$value['create_time'] ?></td>
								<td class="opt">
										<a data-id="<?=$value['id'] ?>" class="blue-color h_edit" href="<?=base_url().'Admin/Hotel/hotelEdit/'.$value['id'] ?>"><i class="iconfont" style="margin-right: 3px;">&#xe606;</i>编辑</a>
									<?php if ($value['state'] == 0): ?>
										<a data-id="<?=$value['id'] ?>" class="red-color h_stop" href="javascript:;"><i class="iconfont" style="margin-right: 3px;">&#xe663;</i>停用</span>
									<?php else: ?>
										<a data-id="<?=$value['id'] ?>" class="green-color h_start" href="javascript:;"><i class="iconfont" style="margin-right: 3px;">&#xe67e;</i>启用</span>
									<?php endif ?>
								</td>
							</tr>
						<?php endforeach ?>
					</tbody>
				</table>
			</form>
            <?php $this->load->view('Admin/Page/page'); ?>
		</div>
	</div>







	<script src="/static/lib/jquery-1.12.4.min.js"></script>
	<script type="text/javascript" src="/static/lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="/static/lib/jquery.form.min.js"></script>
    <script type="text/javascript" src="/static/js/common/util.js"></script>
	<script type="text/javascript" src="/static/js/common/upload.js"></script>
	<script type="text/javascript" src="/static/lib/jquery.validate.js"></script>
	<script type="text/javascript" src="/static/lib/messages_zh.js"></script>
	<script type="text/javascript" src="/static/js/common/validateExtend.js"></script>
	<script type="text/javascript" src="/static/js/common/common.js"></script>
    <!-- <script type="text/javascript" src="/static/lib/ueditor/ueditor.config.js"></script>
	<script type="text/javascript" src="/static/lib/ueditor/ueditor.all.min.js"></script>
	<script type="text/javascript" src="/static/lib/ueditor/addCustomizeDialog.js"></script> -->
	<script>
		var baseUrl = '<?=base_url() ?>';
		console.log(baseUrl)		
		$('#table-form').on('click','.h_stop',function(){
			var dataId = $(this).data('id');
			$.confirm({
				msg: '是否停用？',
				confirm(){
					window.location.href = baseUrl + `Admin/Hotel/hotelStop/${dataId}/1`;
				}
			})
		})
		$('#table-form').on('click','.h_start',function(){
			var dataId = $(this).data('id');
			$.confirm({
				msg: '是否启用？',
				confirm(){
					window.location.href = baseUrl + `Admin/Hotel/hotelStop/${dataId}/0`;
				}
			})
		})


	
	</script>
</body>
</html>